<template>
  <!--学习-->
  <div class="admin-web-conclusion-list">
    <w-nav-search-bar
      @change="topBarClick"
      @search="searckBtnClick"
      :options="searchBarOptions"
      :class-model="classModel"/>
    <!--列表数据-->
    <w-cell
      v-for="(v, k) in loadListModel.dataArr"
      :model="v"
      :key="k"
      @reload="reloadData"/>
    <!--底部加载更多-->
    <w-load-more :load-model="loadListModel"/>
  </div>
</template>

<script>
import StudyModel from '@/models/web/StudyModel'
import YBListLoad from '@/models/YBListLoad'
import WLoadMore from '@/components/global/loadMore/index'
import WCell from './cell'
import WNavSearchBar from '@/pages/pc/com/nav/typeAndSelKey'
export default {
  name: 'AdminWebConclusionList',
  components: {
    WLoadMore,
    WCell,
    WNavSearchBar
  },
  data() {
    return {
      /**
       * 列表加载模型
       */
      loadListModel: new YBListLoad(StudyModel, { type: '' }),
      /**
       * 查找对象
       */
      search: {
        key: null,
        type: '0'
      },
      /**
       * 类模型
       */
      classModel: StudyModel,
      /**
       * 搜索框数组
       */
      searchBarOptions: ['所有', '标题', '描述', '内容']
    }
  },
  methods: {
    /**
     * 顶部导航栏点击
     * @param e 导航标题
     */
    topBarClick(e) {
      const key = e.label === '全部' ? '' : e.label
      this.loadListModel.otherData.type = key
      this.reloadData()
    },
    /**
     * 重新加载数据
     */
    reloadData() {
      this.loadListModel.clearData()
      this.loadListModel.loadData().w_then()
    },
    /**
     * 查找按钮点击
     */
    searckBtnClick(key, type) {
      this.loadListModel.otherData.searchType = type
      this.loadListModel.otherData.searchKey = key
      this.reloadData()
    }
  }
}
</script>

<style lang="scss" scoped>
  .admin-web-conclusion-list {

  }
</style>
